<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\Log;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Input;

class LogController extends Controller
{
    //
    public function __construct()
    {
        $this->middleware('auth');
    }

    public function index(){
        $user = Auth::user();
        $log = Log::Id()->orderByDesc('time')->paginate(15);
        return view('log',[
            'log'=>$log,
            'user'=>$user,
        ]);
    }
    public function deleteLog(){
        $logId=Input::get('id');
        Log::destroy($logId);
        return $logId;
    }
}
